package com.ruoyi.personnel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.personnel.domain.TeachingCertificate;
import com.ruoyi.personnel.mapper.TeachingCertificateMapper;
import com.ruoyi.personnel.service.ITeachingCertificateService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 教师资格证Service业务层处理
 *
 * @author ruoyi
 * @date 2021-03-03
 */
@Service
public class TeachingCertificateServiceImpl extends ServiceImpl<TeachingCertificateMapper, TeachingCertificate> implements ITeachingCertificateService {

    @Override
    public List<TeachingCertificate> queryList(TeachingCertificate teachingCertificate) {
        LambdaQueryWrapper<TeachingCertificate> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(teachingCertificate.getName())){
            lqw.like(TeachingCertificate::getName ,teachingCertificate.getName());
        }
        if (StringUtils.isNotBlank(teachingCertificate.getJobNumber())){
            lqw.eq(TeachingCertificate::getJobNumber ,teachingCertificate.getJobNumber());
        }
        if (StringUtils.isNotBlank(teachingCertificate.getPersonnelId())){
            lqw.eq(TeachingCertificate::getPersonnelId ,teachingCertificate.getPersonnelId());
        }
        if (StringUtils.isNotBlank(teachingCertificate.getCertificateName())){
            lqw.like(TeachingCertificate::getCertificateName ,teachingCertificate.getCertificateName());
        }
        if (StringUtils.isNotBlank(teachingCertificate.getAwardOffice())){
            lqw.eq(TeachingCertificate::getAwardOffice ,teachingCertificate.getAwardOffice());
        }
        if (teachingCertificate.getAwardOfficeId() != null){
            lqw.eq(TeachingCertificate::getAwardOfficeId ,teachingCertificate.getAwardOfficeId());
        }
        if (StringUtils.isNotBlank(teachingCertificate.getAuthenticationTime())){
            lqw.eq(TeachingCertificate::getAuthenticationTime ,teachingCertificate.getAuthenticationTime());
        }
        if (StringUtils.isNotBlank(teachingCertificate.getCertificateType())){
            lqw.eq(TeachingCertificate::getCertificateType ,teachingCertificate.getCertificateType());
        }
        if (StringUtils.isNotBlank(teachingCertificate.getCertificateSubject())){
            lqw.eq(TeachingCertificate::getCertificateSubject ,teachingCertificate.getCertificateSubject());
        }
        if (StringUtils.isNotBlank(teachingCertificate.getCertificateNo())){
            lqw.eq(TeachingCertificate::getCertificateNo ,teachingCertificate.getCertificateNo());
        }
        if (StringUtils.isNotBlank(teachingCertificate.getEnclosure())){
            lqw.eq(TeachingCertificate::getEnclosure ,teachingCertificate.getEnclosure());
        }
        if (StringUtils.isNotBlank(teachingCertificate.getEnclosureName())){
            lqw.like(TeachingCertificate::getEnclosureName ,teachingCertificate.getEnclosureName());
        }
        if (StringUtils.isNotBlank(teachingCertificate.getStatus())){
            lqw.eq(TeachingCertificate::getStatus ,teachingCertificate.getStatus());
        }
        return this.list(lqw);
    }
}
